<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户充值记录</title>
    <link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/common.css" media="all">
    <script src="../../js/layui/layui.js"></script>
    <script src="../../js/layui/layui.all.js"></script>
    <script src="../../js/config.js"></script>
    <script src="../../js/token.js"></script>
</head>
<body>
<blockquote class="layui-elem-quote quoteBox mod_default_box">
    <form class="layui-form">
        <div class="layui-form-inline">
            <label class="layui-form-label">充值日期</label>
            <div class="layui-input-inline">
                <input type="text" id="start_time" name="start_time" autocomplete="off" placeholder="请输入开始时间" class="layui-input">
            </div> 至
            <div class="layui-input-inline">
                <input type="text" id="end_time" name="end_time" autocomplete="off" placeholder="请输入结束时间" class="layui-input">
            </div>
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="search-cz-submit">
                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
        </div>
    </form>
</blockquote>
<div class="layui-card-body">
    <input type="hidden" class="input-text" id="staffId" name="staffId">
    <table class="layui-hide" id="t" lay-filter="t"></table>
</div>
</body>

<script>

    window.onload = function(){
        $("input[name='staffId']").val(GetQueryString("staffId"));
    }
    layui.use(['table'], function() {
        var $ = layui.$;
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var staffId = $("#staffId").val();
        if (null == staffId || "" == staffId) {
            staffId = GetQueryString("staffId");
        }
        table.render({
            elem: '#t',
            id: 'tt',
            toolbar: '#tb',
            url: HOST+'cz/getCzByUser',
            where: {
                staffId: staffId
            },
            cols: [
                [{
                    field: 'id',
                    title: '序号',
                    type: 'numbers',
                    align: 'center'
                },
                    {
                        field: 'staffName',
                        title: '姓名',
                        width: '10%',
                        align: 'center'
                    },
                    {
                        field: 'staffBh',
                        title: '编号',
                        width : '10%',
                        align: 'center'
                    },
                    {
                        field: 'staffPhone',
                        title: '联系方式',
                        width : '15%',
                        align: 'center'
                    },
                    /*{
                        field: 'staffSfz',
                        title: '证件号码',
                        width : '12.5%',
                        align: 'center'
                    },*/
                    {
                        field: 'cardNo',
                        title: '会员卡号',
                        width : '15%',
                        align: 'center'
                    },
                    {
                        field: 'czAmount',
                        title: '充值金额',
                        width : '10%',
                        align: 'center'
                    },
                    {
                        field: 'czTime',
                        title: '充值时间',
                        width: '20%',
                        align: 'center'
                    }]
            ], page: true
            ,page: {
                curr: layui.data("cz_page").index
            },
            done: (res, curr, count) => {
                layui.data("cz_page", {
                    key: 'index',
                    value: curr
                });
            }
        });
        //搜索操作
        form.on('submit(search-cz-submit)', function (data) {
            table.reload('tt', {
                where: {"start_time":data.field.start_time,"end_time":data.field.end_time }
                , page: {
                    curr: 1
                }
            });
            return false;
        });
    })
</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        var endDate= laydate.render({
            elem: '#end_time',//选择器结束时间
            type: 'datetime',
            min:"1970-1-1",//设置min默认最小值
            done: function(value,date){
                startDate.config.max={
                    year:date.year,
                    month:date.month-1,//关键
                    date: date.date,
                    hours: 0,
                    minutes: 0,
                    seconds : 0
                }
            }
        });
        //日期范围
        var startDate=laydate.render({
            elem: '#start_time',
            type: 'datetime',
            max:"2099-12-31",//设置一个默认最大值
            done: function(value, date){
                endDate.config.min ={
                    year:date.year,
                    month:date.month-1, //关键
                    date: date.date,
                    hours: 0,
                    minutes: 0,
                    seconds : 0
                };
            }
        });
    });
</script>

</html>